package kpython.backend.ir.tree;

import java.util.LinkedList;
import java.util.List;

public class IFBlock extends Block {
	public List<IFStmt> stmts = new LinkedList<IFStmt>();	
	public SimpleBlock elseBlock = null;		
	
	public void addStmt(IFStmt stmt) {
		stmts.add(stmt);
	}
		
	public void printTree(String tab) {
		System.out.println(tab+this.getClass().getSimpleName());
		for(IFStmt stmt: stmts) 
			stmt.printTree(tab+"\t");
		if(elseBlock != null)
			elseBlock.printTree(tab+"\t");	
	}
	
	public Object accept(IRTreeVisitor visitor, Object data) {
		return visitor.visit(this, data);
	}
	
	public String toString() {
		return this.getClass().getSimpleName();
	}
}
